/**
 * 
 */
package ipebg.mzk.provider.system.service.impl;

import ipebg.mzk.common.util.Page;
import ipebg.mzk.facade.system.service.PagerService;
import ipebg.mzk.provider.system.dao.QueryForPagesDAO;

import java.io.Serializable;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

 

/**
 * @Descrition 通用hibernate DAO操作.
 * 
 * @Date: 2010/12/6
 * 
 */
@Service("pageServiceImpl")
public class PagerServiceImpl<T> implements PagerService<T> {

	@Resource(name="queryForPagesDAO")
	private QueryForPagesDAO<T> pagesDAO;
	
	@Override
	public Page findPageByQuery(int pageNo, int pageSize, String hql,
			Map<Serializable, Serializable> map,T t) {
		
		return null;
	}
	
	
	@Override
	public Page findPageBySqlQuery(int pageNo, int pageSize, String sql) {
		return pagesDAO.findPageBySqlQuery(pageNo, pageSize, sql);
	}
	

	@Override
	@Transactional
	public Page findPageByhqlQuery(int pageNo, int pageSize, String hql) {
		return pagesDAO.findPageByhqlQuery(pageNo, pageSize, hql);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageByCriteria(int pageNo, int pageSize, Map map, T t,
			String orderStr,String flag) {
		return pagesDAO.findPageByCriteria(pageNo,pageSize,map,t,orderStr,flag);
	}

	
	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageByCriteria(int pageNo, int pageSize, Map map, T t,
			String[] orderStrs, String flag) {
		return pagesDAO.findPageByCriteria(pageNo,pageSize,map,t,orderStrs,flag);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageByCriteriaWithNull(int pageNo, int defaultPageSize,
			Map map, T t, String[] orderStrs,String flag) {
		return pagesDAO.findPageByCriteriaWithNull(pageNo, defaultPageSize, map, t, orderStrs, flag);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageByCriteriaAndIn(int pageNo, int pageSize, Map map, T t,
			String[] orderStrs, String flag) {
		return pagesDAO.findPageByCriteriaAndIn(pageNo, pageSize, map, t, orderStrs, flag);
	}
	
	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageByCriteriaAndInLike(int pageNo, int pageSize, Map map, T t,
			String[] orderStrs, String flag) {
		return pagesDAO.findPageByCriteriaAndInLike(pageNo, pageSize, map, t, orderStrs, flag);
	}
	


	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageByCriteriaOneMonth(int pageNo, int pageSize, Map map,
			T t, String[] orderStrs, String flag) {
		return pagesDAO.findPageByCriteriaOneMonth(pageNo, pageSize, map, t, orderStrs, flag);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Page findPageBySqlRestrictionCriteria(int pageNo, int pageSize,
			Map map, Class cls, String sql) {
		return pagesDAO.findPageBySqlRestrictionCriteria(pageNo, pageSize, map, cls, sql);
	}

	@Override
	public Page findPageByCriteria(int pageNo, int pageSize, Map map, T t,
			String userId) {
		// TODO Auto-generated method stub
		return pagesDAO.findPageByCriteria(pageNo, pageSize, map, t, userId);
	}

	@Override
	public Page findPageBySqlQuery2Map(int pageNo, int pageSize, String sql) {
	    return pagesDAO.findPageBySql(Map.class, pageNo, pageSize, sql);
	}

	@Override
	public <E> Page findPageBySqlQuery2Entity(Class<E> cls, int pageNo, int pageSize, String sql) {
		return pagesDAO.findPageBySql(cls, pageNo, pageSize, sql);
	}

	@Override
	public Page findPageByHqlQuery2Map(int pageNo, int pageSize, String sql) {
		return pagesDAO.findPageByHql(Map.class,pageNo,pageSize,sql);
	}

	@Override
	public <E> Page findPageByHqlQuery2Entity(Class<E> cls, int pageNo, int pageSize, String sql) {
		return pagesDAO.findPageByHql(cls,pageNo,pageSize,sql);
	}


}
